<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Thymeleaf语法</title>
</head>
<body>

<h3>变量输出</h3>
<h4 th:text="${name}"></h4>
<h4 th:text="李四"></h4>

<hr/>

<h3>条件判断</h3>
<div th:if="${gender} == '男'">
	这是一位男性朋友
</div>
<div th:if="${gender} == '女'">
	这是一位女性朋友
</div>
<br/>
<div th:switch="${grade}">
	<span th:case="1">这是1的情况</span>
	<span th:case="2">这是2的情况</span>
	<span th:case="3">这是3的情况</span>
</div>

<hr/>

<h3>迭代遍历</h3>
<table border="1">
	<tr>
		<td>编号</td>
		<td>姓名</td>
		<td>年龄</td>
	</tr>
	<tr th:each="user : ${list}">
		<td th:text="${user.id}"></td>
		<td th:text="${user.name}"></td>
		<td th:text="${user.age}"></td>
	</tr>
</table>

<hr/>

<h3>域对象数据的获取</h3>
request: <span th:text="${#httpServletRequest.getAttribute('request')}"></span><br/>
session: <span th:text="${session.session}"></span><br/>
application: <span th:text="${application.application}"></span><br/>

<hr/>

<h3>超链接的语法</h3>
<a th:href="@{~/demo1}">访问demo1</a><br/>

<a th:href="@{~/demo1(id=1,name=eric)}">访问demo1,传递参数</a>
</body>
</html>